//
//  SimNavController.m
//  Knowbox
//
//  Created by LiuXubin on 15/1/26.
//  Copyright (c) 2015年 knowin. All rights reserved.
//

#import "SimNavController.h"

@interface SimNavController ()

@end

@implementation SimNavController

- (UIInterfaceOrientationMask)supportedInterfaceOrientations
{
    return UIInterfaceOrientationMaskPortrait;
}

- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation
{
    return UIInterfaceOrientationPortrait;
}

- (void)viewDidLoad {
    [super viewDidLoad];
    
    self.navigationBar.translucent = NO;
    if ([self.navigationBar respondsToSelector:@selector(setShadowImage:)]) {
        UIImage *blankImage = [[UIImage alloc] init];
        [[UINavigationBar appearance] setShadowImage:blankImage];
        blankImage = nil;
    }
}


+ (void)setFont:(UIFont *)font textColor:(UIColor *)textColor
{
    NSDictionary *textAttributes = @{UITextAttributeFont: font,
                                     UITextAttributeTextColor: textColor
                                     };
    
    UIBarButtonItem *buttonItemAppearance = [UIBarButtonItem appearanceWhenContainedIn:[UINavigationBar class], nil];
    [buttonItemAppearance setTitleTextAttributes:textAttributes forState:UIControlStateNormal];
    
    [[UINavigationBar appearance] setTitleTextAttributes:textAttributes];
}

+ (void)setNavBgImage:(UIImage *)bgImage
{
    [[UINavigationBar appearance] setBackgroundImage:[bgImage stretchableImageWithLeftCapWidth:bgImage.size.width/2 topCapHeight:0] forBarMetrics:UIBarMetricsDefault];
    
}





@end
